<template>
    <div>
        <h1>我是根组件{{ money }}---{{ car }}</h1>
        <Child :money="money" @getCar="getCar" />
    </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
//引入子组件
import Child from './components/Child.vue';
export default defineComponent({
    setup() {
        //父亲的响应式数据钱
        const money = ref(10000);
        const car = ref('');
        return {
            money,
            car,
            getCar(che: string) {
                car.value = che;
            }
        }
    },
    components: {
        Child
    }
})
</script>

<style scoped></style>